package com.wufan.day02;

/**
 * 生成6个30以内的随机数
 * @author SongWufan
 * @date 2021/3/5 11:00
 */
public class ArrayTest5 {
    public static void main(String[] args) {
        int[] arr = new int[6];
        for (int i = 0; i < arr.length; i++){
            arr[i] = (int) ((Math.random() * 30) + 1);
            for (int j = 0; j < i; j++){
                if (arr[i] == arr[j]){
                    i--;
                    break;
                }
            }
        }
        for (int i = 0; i < arr.length; i++){
            System.out.println(arr[i]);
        }
    }
}
